home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / mus / misc / P6101.lha / Player6.1A / Source / 610.1.G < prev    next >
Encoding:
Text File  |  1995-03-17  |  39.7 KB  |  2,642 lines

  1. * The Player 6.1A for Asm-One 1.09 and later *
  2.  
  3. ;start = 6    ;Starting position
  4.  
  5. fade  = 1    ;0 = Normal, NO master volume control possible
  6.         ;1 = Use master volume (P61_Master)
  7.  
  8. jump = 1    ;0 = do NOT include position jump code (P61_SetPosition)
  9.         ;1 = Include
  10.  
  11. system = 1    ;0 = killer
  12.         ;1 = friendly
  13.  
  14. CIA = 1        ;0 = CIA disabled
  15.         ;1 = CIA enabled
  16.  
  17. exec = 1    ;0 = ExecBase destroyed
  18.         ;1 = ExecBase valid
  19.  
  20. lev6 = 1    ;0 = NonLev6
  21.         ;1 = Lev6 used
  22.  
  23. opt020 = 0    ;0 = MC680x0 code
  24.         ;1 = MC68020+ or better
  25.  
  26. channels = 4    ;amount of channels to be played
  27.  
  28. use = -1    ;The Usecode
  29.  
  30.     incdir    include:
  31.     include Player61.i
  32.  
  33. *-----------------------------------------------*
  34.  
  35.     printt    ""
  36.     printt    "Options used:"
  37.     printt    "-------------"
  38.     ifd    start
  39.     printt    "Starting from position"
  40.     printv    start
  41.     endc
  42.     ifne    fade
  43.     printt    "Mastervolume on"
  44.     else
  45.     printt    "Mastervolume off"
  46.     endc
  47.     ifne    system
  48.     printt    "System friendly"
  49.     else
  50.     printt    "System killer"
  51.     endc
  52.     ifne    CIA
  53.     printt    "CIA-tempo on"
  54.     else
  55.     printt    "CIA-tempo off"
  56.     endc
  57.     ifne    exec
  58.     printt    "ExecBase valid"
  59.     else
  60.     printt    "ExecBase invalid"
  61.     endc
  62.     ifne    lev6
  63.     printt    "Level 6 IRQ on"
  64.     else
  65.     printt    "Non-lev6 NOT IMPLEMENTED!"
  66.     if2
  67.     fail
  68.     endc
  69.     endc
  70.     ifne    opt020
  71.     printt    "MC68020 optimizations"
  72.     else
  73.     printt    "Normal MC68000 code"
  74.     endc
  75.     printt    "Channels:"
  76.     printv    channels
  77.     ifgt    channels-4
  78.     printt    "NO MORE THAN 4 CHANNELS!"
  79.     if2
  80.     fail
  81.     endc
  82.     endc
  83.     ifeq    channels
  84.     printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  85.     if2
  86.     fail
  87.     endc
  88.     endc
  89.     printt    "UseCode:"
  90.     printv    use
  91.  
  92. *-----------------------------------------------*
  93.  
  94.  
  95.     section    Player6.1A,code
  96.  
  97.     movem.l    d0-a6,-(sp)
  98.     lea    $dff000,a6
  99.     ifeq    system
  100.     move    $1c(a6),-(sp)
  101.     move    #$7fff,$9a(a6)
  102.     move    2(a6),-(sp)
  103.     move    #$7ff,$96(a6)
  104.     endc
  105.  
  106.     lea    P61_data,a0    ;Module
  107.     sub.l    a1,a1        ;No separate samples
  108. ;    lea    P61_smp,a1    ;Samples
  109.  
  110.     lea    samples,a2    ;Sample buffer
  111.     moveq    #0,d0        ;Auto Detect
  112.     bsr    P61_motuuli+P61_InitOffset
  113.  
  114.     tst    d0        ;Went ok?
  115.     bne    P61_exit
  116.  
  117. P61_sync
  118.     ifeq    CIA
  119.     move.l    4(a6),d0
  120.     andi.l    #$1ff00,d0
  121.     cmp.l    #$8100,d0
  122.     bne.b    P61_sync
  123.  
  124. P61_sync2
  125.     move.l    4(a6),d0
  126.     andi.l    #$1ff00,d0
  127.     cmp.l    #$8200,d0
  128.     bne.b    P61_sync2
  129.  
  130.     move    #$fff,$180(a6)
  131.     bsr    P61_motuuli+P61_MusicOffset
  132.     clr    $180(a6)
  133.  
  134.     moveq    #0,d0
  135.     move    6(a6),d0
  136.     sub.l    #$8200,d0
  137.     cmp.l    P61_raster(pc),d0
  138.     ble.b    P61_kosj
  139.     move    d0,P61_raster+2
  140. P61_kosj
  141.     tst    P61_raster2+2
  142.     bne.b    P61_doing
  143.     move    d0,P61_raster2+2
  144.     bra.b    P61_doneg
  145. P61_doing
  146.     add.l    P61_raster2(pc),d0
  147.     asr.l    #1,d0
  148.     move.l    d0,P61_raster2
  149. P61_doneg
  150.     addq.l    #1,P61_frames
  151.  
  152.     ifne    fade
  153.     btst    #10,$16(a6)
  154.     bne.b    P61_jid
  155.     move    P61_diri(pc),d0
  156.     sub    d0,P61_motuuli+P61_MasterVolume
  157.     bne.b    P61_judo
  158.     neg    P61_diri
  159.     bra.b    P61_jid
  160. P61_judo
  161.     cmp    #64,P61_motuuli+P61_MasterVolume
  162.     bne.b    P61_jid
  163.     neg    P61_diri
  164.     endc
  165.  
  166. P61_jid
  167.     endc
  168.  
  169.     btst    #6,$bfe001
  170.     bne    P61_sync
  171.  
  172. P61_exit
  173.     bsr    P61_motuuli+P61_EndOffset
  174.  
  175.     ifeq    system
  176.     move    (sp)+,d7
  177.     bset    #15,d7
  178.     move    #$7ff,$96(a6)
  179.     move    d7,$96(a6)
  180.  
  181.     move    (sp)+,d7
  182.     bset    #15,d7
  183.     move    #$7fff,$9a(a6)
  184.     move    d7,$9a(a6)
  185.     endc
  186.     movem.l    (sp)+,d0-a6
  187.  
  188.     move.l    P61_raster(pc),d0
  189.     move.l    P61_raster2(pc),d1
  190.     move.l    P61_frames(pc),d2
  191.     move.l    P61_positionbase(pc),a0
  192.     move.l    P61_patternbase(pc),a1
  193.     move.l    P61_spos(pc),a2
  194.     rts
  195.  
  196. P61_IRQsave    dc    0
  197. P61_DMAsave    dc    0
  198. P61_raster    dc.l    0
  199. P61_raster2    dc.l    0
  200. P61_frames    dc.l    0
  201. P61_diri    dc    1
  202.  
  203. *********************************
  204. *        Player 6.1A ®        *
  205. *      All in one-version    *
  206. *        Version 610.1        *
  207. *   © 1992-95 Jarno Paananen    *
  208. *     All rights reserved    *
  209. *********************************
  210.  
  211.  
  212. ******** START OF BINARY FILE **************
  213.  
  214. P61_motuuli
  215.     bra    P61_Init
  216.     ifeq    CIA
  217.     bra    P61_Music
  218.     else
  219.     rts
  220.     rts
  221.     endc
  222.     bra    P61_End
  223.     rts                ;no P61_SetRepeat
  224.     rts
  225.     bra    P61_SetPosition
  226.  
  227. P61_Master    dc    64        ;Master volume (0-64)
  228. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  229. P61_Play    dc    1        ;Stop flag (0=stop)
  230. P61_E8        dc    0        ;Info nybble after command E8
  231. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  232.                     ;put VBR here! (Otherwise 0 assumed)
  233.                     ;You can also get VBR from here, if
  234.                     ;using exec-valid version
  235.  
  236. P61_Pos        dc    0        ;Current song position
  237. P61_Patt    dc    0        ;Current pattern
  238. P61_CRow    dc    0        ;Current pattern row
  239.  
  240. P61_Temp0Offset
  241.     dc.l    P61_temp0-P61_motuuli
  242. P61_Temp1Offset
  243.     dc.l    P61_temp1-P61_motuuli
  244. P61_Temp2Offset
  245.     dc.l    P61_temp2-P61_motuuli
  246. P61_Temp3Offset
  247.     dc.l    P61_temp3-P61_motuuli
  248.  
  249. P61_getnote    macro
  250.     moveq    #$7e,d0
  251.     and.b    (a5),d0
  252.     beq.b    .nonote
  253.     ifne    P61_vib
  254.     clr.b    P61_VibPos(a5)
  255.     endc
  256.     ifne    P61_tre
  257.     clr.b    P61_TrePos(a5)
  258.     endc
  259.  
  260.     ifne    P61_ft
  261.     add    P61_Fine(a5),d0
  262.     endc
  263.     move    d0,P61_Note(a5)
  264.     move    (a2,d0),P61_Period(a5)
  265.  
  266. .nonote
  267.     endm
  268.  
  269.     ifeq    system
  270.     ifne    CIA
  271. P61_intti
  272.     movem.l    d0-a6,-(sp)
  273.     tst.b    $bfdd00
  274.     lea    $dff000,a6
  275.     move    #$2000,$9c(a6)
  276.     move    #$fff,$180(a6)
  277.     bsr    P61_Music
  278.     move    #0,$180(a6)
  279.     movem.l    (sp)+,d0-a6
  280.     nop
  281.     rte
  282.     endc
  283.     endc
  284.  
  285.     ifne    system
  286. P61_lev6server
  287.     movem.l    d2-d7/a2-a6,-(sp)
  288.     lea    $dff000,a6
  289.  
  290.     move    P61_server(pc),d0
  291.     beq.b    P61_musica
  292.     subq    #1,d0
  293.     beq    P61_dmason
  294.     bra    P61_setrepeat
  295.  
  296. P61_musica
  297.     bsr    P61_Music
  298.  
  299. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  300.     moveq    #1,d0
  301.     rts
  302.     endc
  303.  
  304. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  305. ;­ Call P61_Init to initialize the playroutine    ­
  306. ;­ D0 --> Timer detection (for CIA-version)    ­
  307. ;­ A0 --> Address to the module            ­
  308. ;­ A1 --> Address to samples/0            ­
  309. ;­ A2 --> Address to sample buffer        ­
  310. ;­ D0 <-- 0 if succeeded            ­
  311. ;­ A6 <-- $DFF000                ­
  312. ;­         Uses D0-A6            ­
  313. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  314.  
  315. P61_Init
  316.     cmp.l    #"P61A",(a0)+
  317.     beq.b    .modok
  318.     subq.l    #4,a0
  319.  
  320. .modok    basereg    P61_cn,a3
  321.  
  322.     ifne    CIA
  323.     move    d0,-(sp)
  324.     endc
  325.  
  326.     moveq    #0,d0
  327.     cmp.l    d0,a1
  328.     bne.b    .redirect
  329.  
  330.     move    (a0),d0
  331.     lea    (a0,d0.l),a1
  332. .redirect
  333.     move.l    a2,a6
  334.     lea    8(a0),a2
  335.     moveq    #$40,d0
  336.     and.b    3(a0),d0
  337.     bne.b    .buffer
  338.     move.l    a1,a6
  339.     subq.l    #4,a2
  340. .buffer
  341.  
  342.     lea    P61_cn(pc),a3
  343.     moveq    #$1f,d1
  344.     and.b    3(a0),d1
  345.     move.l    a0,-(sp)
  346.     lea    P61_Samples(pc),a4
  347.     subq    #1,d1
  348.     moveq    #0,d4
  349. P61_lopos
  350.     move.l    a6,(a4)+
  351.     move    (a2)+,d4
  352.     bpl.b    P61_kook
  353.     neg    d4
  354.     lea    P61_Samples-16(pc),a5
  355.     ifeq    opt020
  356.     asl    #4,d4
  357.     move.l    (a5,d4),d6
  358.     else
  359.     add    d4,d4
  360.     move.l    (a5,d4*8),d6
  361.     endc
  362.     move.l    d6,-4(a4)
  363.     move    4(a5,d4),d4
  364.     sub.l    d4,a6
  365.     sub.l    d4,a6
  366.     bra.b    P61_jatk
  367.  
  368. P61_kook
  369.     move.l    a6,d6
  370.     tst.b    3(a0)
  371.     bpl.b    P61_jatk
  372.  
  373.     tst.b    (a2)
  374.     bmi.b    P61_jatk
  375.  
  376.     move    d4,d0
  377.     subq    #2,d0
  378.     bmi.b    P61_jatk
  379.  
  380.     move.l    a1,a5
  381.     move.b    (a5)+,d2
  382.     sub.b    (a5),d2
  383.     move.b    d2,(a5)+
  384. .loop    sub.b    (a5),d2
  385.     move.b    d2,(a5)+
  386.     sub.b    (a5),d2
  387.     move.b    d2,(a5)+
  388.     dbf    d0,.loop
  389.  
  390. P61_jatk
  391.     move    d4,(a4)+
  392.     moveq    #0,d2
  393.     move.b    (a2)+,d2
  394.     moveq    #0,d3
  395.     move.b    (a2)+,d3
  396.  
  397.     moveq    #0,d0
  398.     move    (a2)+,d0
  399.     bmi.b    .norepeat
  400.  
  401.     move    d4,d5
  402.     sub    d0,d5
  403.     move.l    d6,a5
  404.  
  405.     add.l    d0,a5
  406.     add.l    d0,a5
  407.  
  408.     move.l    a5,(a4)+
  409.     move    d5,(a4)+
  410.     bra.b    P61_gene
  411. .norepeat
  412.     move.l    d6,(a4)+
  413.     move    #1,(a4)+
  414. P61_gene
  415.     move    d3,(a4)+
  416.     moveq    #$f,d0
  417.     and    d2,d0
  418.     mulu    #74,d0
  419.     move    d0,(a4)+
  420.  
  421.     tst    -6(a2)
  422.     bmi.b    .nobuffer
  423.  
  424.     moveq    #$40,d0
  425.     and.b    3(a0),d0
  426.     beq.b    .nobuffer
  427.  
  428.     move    d4,d7
  429.     tst.b    d2
  430.     bpl.b    .copy
  431.  
  432.     subq    #1,d7
  433.     moveq    #0,d5
  434.     moveq    #0,d4
  435. .lo    move.b    (a1)+,d4
  436.     moveq    #$f,d3
  437.     and    d4,d3
  438.     lsr    #4,d4
  439.  
  440.     sub.b    .table(pc,d4),d5
  441.     move.b    d5,(a6)+
  442.     sub.b    .table(pc,d3),d5
  443.     move.b    d5,(a6)+
  444.     dbf    d7,.lo
  445.     bra.b    .kop
  446.  
  447. .copy    add    d7,d7
  448.     subq    #1,d7
  449. .cob    move.b    (a1)+,(a6)+
  450.     dbf    d7,.cob
  451.     bra.b    .kop
  452.  
  453. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  454.  
  455. .nobuffer
  456.     move.l    d4,d6
  457.     add.l    d6,d6
  458.     add.l    d6,a6
  459.     add.l    d6,a1
  460. .kop    dbf    d1,P61_lopos
  461.  
  462.     move.l    (sp)+,a0
  463.     and.b    #$7f,3(a0)
  464.  
  465.     move.l    a2,-(sp)
  466.  
  467.     lea    P61_temp0(pc),a1
  468.     lea    P61_temp1(pc),a2
  469.     lea    P61_temp2(pc),a4
  470.     lea    P61_temp3(pc),a5
  471.     moveq    #Channel_Block_SIZE/2-2,d0
  472.  
  473.     moveq    #0,d1
  474. .cl    move    d1,(a1)+
  475.     move    d1,(a2)+
  476.     move    d1,(a4)+
  477.     move    d1,(a5)+
  478.     dbf    d0,.cl
  479.  
  480.     move.l    (sp)+,a2
  481.     move.l    a2,P61_positionbase(a3)
  482.  
  483.     moveq    #$7f,d1
  484.     and.b    2(a0),d1
  485.  
  486.     ifeq    opt020
  487.     lsl    #3,d1
  488.     lea    (a2,d1.l),a4
  489.     else
  490.     lea    (a2,d1.l*8),a4
  491.     endc
  492.     move.l    a4,P61_possibase(a3)
  493.  
  494.     move.l    a4,a1
  495.     moveq    #-1,d0
  496. .search    cmp.b    (a1)+,d0
  497.     bne.b    .search
  498.     move.l    a1,P61_patternbase(a3)    
  499.     move.l    a1,d0
  500.     sub.l    a4,d0
  501.     move    d0,P61_slen(a3)
  502.  
  503.     ifd    start
  504.     lea    start(a4),a4
  505.     endc
  506.  
  507.     moveq    #0,d0
  508.     move.b    (a4)+,d0
  509.     move.l    a4,P61_spos(a3)
  510.     lsl    #3,d0
  511.     add.l    d0,a2
  512.  
  513.     move.l    a1,a4
  514.     moveq    #0,d0    
  515.     move    (a2)+,d0
  516.     lea    (a4,d0.l),a1
  517.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  518.     move    (a2)+,d0
  519.     lea    (a4,d0.l),a1
  520.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  521.     move    (a2)+,d0
  522.     lea    (a4,d0.l),a1
  523.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  524.     move    (a2)+,d0
  525.     lea    (a4,d0.l),a1
  526.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  527.  
  528.     lea    P61_setrepeat(pc),a0
  529.     move.l    a0,P61_intaddr(a3)
  530.  
  531.     move    #63,P61_rowpos(a3)
  532.     move    #6,P61_speed(a3)
  533.     move    #5,P61_speed2(a3)
  534.     clr    P61_speedis1(a3)
  535.  
  536.     ifne    P61_pl
  537.     clr.l    P61_plcount(a3)
  538.     endc
  539.  
  540.     ifne    P61_pde
  541.     clr    P61_pdelay(a3)
  542.     clr    P61_pdflag(a3)
  543.     endc
  544.     clr    (a3)
  545.  
  546.     moveq    #2,d0
  547.     and.b    $bfe001,d0
  548.     move.b    d0,P61_ofilter(a3)
  549.     bset    #1,$bfe001
  550.  
  551.     ifeq    system
  552.     ifne    exec
  553.     move.l    4.w,a6
  554.     moveq    #0,d0
  555.     btst    d0,297(a6)
  556.     beq.b    .no68010
  557.  
  558.     lea    P61_liko(pc),a5
  559.     jsr    -$1e(a6)
  560.  
  561. .no68010
  562.     move.l    d0,P61_VBR(a3)
  563.     endc
  564.  
  565.     move.l    P61_VBR(a3),a0
  566.     lea    $78(a0),a0
  567.     move.l    a0,P61_vektori(a3)
  568.  
  569.     move.l    (a0),P61_oldlev6(a3)
  570.     lea    P61_dmason(pc),a1
  571.     move.l    a1,(a0)
  572.     endc
  573.  
  574.     moveq    #0,d0
  575.     lea    $dff000,a6
  576.     move    d0,$a8(a6)
  577.     move    d0,$b8(a6)
  578.     move    d0,$c8(a6)
  579.     move    d0,$d8(a6)
  580.     move    #$f,$96(a6)
  581.  
  582.     ifeq    system
  583.     lea    P61_dmason(pc),a1
  584.     move.l    a1,(a0)
  585.     move    #$2000,$9a(a6)
  586.     lea    $bfd000,a0
  587.     lea    P61_Timers(pc),a1
  588.     move.b    #$7f,$d00(a0)
  589.     move.b    #$10,$e00(a0)
  590.     move.b    #$10,$f00(a0)
  591.     move.b    $400(a0),(a1)+
  592.     move.b    $500(a0),(a1)+
  593.     move.b    $600(a0),(a1)+
  594.     move.b    $700(a0),(a1)
  595.     endc
  596.  
  597.     ifeq    system!CIA
  598.     move.b    #$82,$d00(a0)
  599.     endc
  600.  
  601.     ifne    CIA
  602.     move    (sp)+,d0
  603.     subq    #1,d0
  604.     beq.b    P61_ForcePAL
  605.     subq    #1,d0
  606.     beq.b    P61_NTSC
  607.     ifne    exec
  608.     move.l    4.w,a1
  609.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  610.     beq.b    P61_NTSC
  611.     endc
  612. P61_ForcePAL
  613.     move.l    #1773447,d0    ;PAL
  614.     bra.b    P61_setcia
  615. P61_NTSC
  616.     move.l    #1789773,d0    ;NTSC
  617. P61_setcia
  618.     move.l    d0,P61_timer(a3)
  619.     divu    #125,d0
  620.     move    d0,P61_thi2(a3)
  621.     sub    #$1f0*2,d0
  622.     move    d0,P61_thi(a3)
  623.  
  624.     ifeq    system
  625.     move    P61_thi2(a3),d0
  626.     move.b    d0,$400(a0)
  627.     lsr    #8,d0
  628.     move.b    d0,$500(a0)
  629.     lea    P61_intti(pc),a1
  630.     move.l    a1,P61_tintti(a3)
  631.     move.l    P61_vektori(pc),a2
  632.     move.l    a1,(a2)
  633.     move.b    #$83,$d00(a0)
  634.     move.b    #$11,$e00(a0)
  635.     endc
  636.     endc
  637.  
  638.     ifeq    system
  639.     move    #$e000,$9a(a6)
  640.     moveq    #0,d0
  641.     rts
  642.  
  643.     ifne    exec
  644. P61_liko
  645.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  646.     rte
  647.     endc
  648.     endc
  649.  
  650.     ifne    system
  651.     move.l    a6,-(sp)
  652.  
  653.     ifne    CIA
  654.     clr    P61_server(a3)
  655.     else
  656.     move    #1,P61_server(a3)
  657.     endc
  658.  
  659.     move.l    4.w,a6
  660.     moveq    #-1,d0
  661.     jsr    -$14a(a6)
  662.     move.b    d0,P61_sigbit(a3)
  663.     bmi    P61_err
  664.  
  665.     lea    P61_allocport(pc),a1
  666.     move.l    a1,P61_portti(a3)
  667.     move.b    d0,15(a1)
  668.     move.l    a1,-(sp)
  669.     suba.l    a1,a1
  670.     jsr    -$126(a6)
  671.     move.l    (sp)+,a1
  672.     move.l    d0,16(a1)
  673.     lea    P61_reqlist(pc),a0
  674.     move.l    a0,(a0)
  675.     addq.l    #4,(a0)
  676.     clr.l    4(a0)
  677.     move.l    a0,8(a0)
  678.  
  679.     lea    P61_dat(pc),a1
  680.     move.l    a1,P61_reqdata(a3)
  681.     lea    P61_allocreq(pc),a1
  682.     lea    P61_audiodev(pc),a0
  683.     moveq    #0,d0
  684.     moveq    #0,d1
  685.     jsr    -$1bc(a6)
  686.     tst.l    d0
  687.     bne    P61_err
  688.     st.b    P61_audioopen(a3)
  689.  
  690.     lea    P61_timerint(pc),a1
  691.     move.l    a1,P61_timerdata(a3)
  692.     lea    P61_lev6server(pc),a1
  693.     move.l    a1,P61_timerdata+8(a3)
  694.  
  695.     moveq    #0,d3
  696.     lea    P61_cianame(pc),a1
  697. P61_openciares
  698.     moveq    #0,d0
  699.     move.l    4.w,a6
  700.     jsr    -$1f2(a6)
  701.     move.l    d0,P61_ciares(a3)
  702.     beq.b    P61_err
  703.     move.l    d0,a6
  704.     lea    P61_timerinterrupt(pc),a1
  705.     moveq    #0,d0
  706.     jsr    -6(a6)
  707.     tst.l    d0
  708.     beq.b    P61_gottimer
  709.     addq.l    #4,d3
  710.     lea    P61_timerinterrupt(pc),a1
  711.     moveq    #1,d0
  712.     jsr    -6(a6)
  713.     tst.l    d0
  714.     bne.b    P61_err
  715.  
  716. P61_gottimer
  717.     lea    P61_craddr+8(pc),a6
  718.     move.l    P61_ciaaddr(pc,d3),d0
  719.     move.l    d0,(a6)
  720.     sub    #$100,d0
  721.     move.l    d0,-(a6)
  722.     moveq    #2,d3
  723.     btst    #9,d0
  724.     bne.b    P61_timerB
  725.     subq.b    #1,d3
  726.     add    #$100,d0
  727. P61_timerB
  728.     add    #$900,d0
  729.     move.l    d0,-(a6)
  730.     move.l    d0,a0
  731.     and.b    #%10000000,(a0)
  732.     move.b    d3,P61_timeropen(a3)
  733.     moveq    #0,d0
  734.  
  735.     ifne    CIA
  736.     move.l    P61_craddr+4(pc),a1
  737.     move.b    P61_tlo(pc),(a1)
  738.     move.b    P61_thi(pc),$100(a1)
  739.     endc
  740.     or.b    #$19,(a0)
  741. P61_pois
  742.     move.l    (sp)+,a6
  743.     rts
  744.  
  745. P61_err    moveq    #-1,d0
  746.     bra.b    P61_pois
  747.     rts
  748.  
  749. P61_ciaaddr
  750.     dc.l    $bfd500,$bfd700
  751.     endc
  752.  
  753. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  754. ;­         Call P61_End to stop the music        ­
  755. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  756. ;­        Uses D0/D1/A0/A1/A3        ­
  757. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  758.  
  759. P61_End    moveq    #0,d0
  760.     move    d0,$a8(a6)
  761.     move    d0,$b8(a6)
  762.     move    d0,$c8(a6)
  763.     move    d0,$d8(a6)
  764.     move    #$f,$96(a6)
  765.  
  766.     and.b    #~2,$bfe001
  767.     move.b    P61_ofilter(pc),d0
  768.     or.b    d0,$bfe001
  769.  
  770.     ifeq    system
  771.     move    #$2000,$9a(a6)
  772.     move.l    P61_vektori(pc),a0
  773.     move.l    P61_oldlev6(pc),(a0)
  774.     lea    $bfd000,a0
  775.     lea    P61_Timers(pc),a1
  776.     move.b    (a1)+,$400(a0)
  777.     move.b    (a1)+,$500(a0)
  778.     move.b    (a1)+,$600(a0)
  779.     move.b    (a1)+,$700(a0)
  780.     move.b    #$10,$e00(a0)
  781.     move.b    #$10,$f00(a0)
  782.  
  783.     else
  784.     move.l    a6,-(sp)
  785.     lea    P61_cn(pc),a3
  786.     moveq    #0,d0
  787.     move.b    P61_timeropen(pc),d0
  788.     beq.b    P61_rem1
  789.     move.l    P61_ciares(pc),a6
  790.     lea    P61_timerinterrupt(pc),a1
  791.     subq.b    #1,d0
  792.     jsr    -12(a6)
  793. P61_rem1
  794.     move.l    4.w,a6
  795.     tst.b    P61_audioopen(a3)
  796.     beq.b    P61_rem2
  797.     lea    P61_allocreq(pc),a1
  798.     jsr    -$1c2(a6)
  799.     clr.b    P61_audioopen(a3)
  800. P61_rem2
  801.     moveq    #0,d0
  802.     move.b    P61_sigbit(pc),d0
  803.     bmi.b    P61_rem3
  804.     jsr    -$150(a6)
  805.     st    P61_sigbit(a3)
  806. P61_rem3
  807.     move.l    (sp)+,a6
  808.     endc
  809.     rts
  810.  
  811.     ifne    fade
  812. P61_mfade
  813.     move    P61_Master(pc),d0
  814.     move    P61_temp0+P61_Shadow(pc),d1
  815.     mulu    d0,d1
  816.     lsr    #6,d1
  817.     move    d1,$a8(a6)
  818.  
  819.     ifgt    channels-1
  820.     move    P61_temp1+P61_Shadow(pc),d1
  821.     mulu    d0,d1
  822.     lsr    #6,d1
  823.     move    d1,$b8(a6)
  824.     endc
  825.  
  826.     ifgt    channels-2
  827.     move    P61_temp2+P61_Shadow(pc),d1
  828.     mulu    d0,d1
  829.     lsr    #6,d1
  830.     move    d1,$c8(a6)
  831.     endc
  832.  
  833.     ifgt    channels-3
  834.     move    P61_temp3+P61_Shadow(pc),d1
  835.     mulu    d0,d1
  836.     lsr    #6,d1
  837.     move    d1,$d8(a6)
  838.     endc
  839.     rts
  840.     endc
  841.     
  842.  
  843. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  844. ;­ Call P61_SetPosition to jump to a specific    ­
  845. ;­          position in the song.        ­
  846. ;­ D0.l --> Position                ­
  847. ;­ Starts from the beginning if out of limits.    ­
  848. ;­              Uses A0/A1/A3/D0-D3        ­
  849. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  850.  
  851. P61_SetPosition
  852.     ifne    jump
  853.     lea    P61_cn(pc),a3
  854.     ifne    P61_pl
  855.     clr    P61_plflag(a3)
  856.     endc
  857.     moveq    #0,d1
  858.     move.b    d0,d1
  859.     move.l    d1,d0
  860.     cmp    P61_slen(a3),d0
  861.     blo.b    .e
  862.     moveq    #0,d0
  863. .e    move    d0,P61_Pos(a3)
  864.     add.l    P61_possibase(pc),d0
  865.     move.l    d0,P61_spos(a3)
  866.  
  867.     moveq    #64,d0
  868.     move    d0,P61_rowpos(a3)
  869.     clr    P61_CRow(a3)
  870.     move.l    P61_spos(pc),a1
  871.     move.l    P61_patternbase(pc),a0
  872.     addq    #1,P61_Pos(a3)
  873.     move.b    (a1)+,d0
  874.     move.l    a1,P61_spos(a3)
  875.     move.l    P61_positionbase(pc),a1
  876.     move    d0,P61_Patt(a3)
  877.     lsl    #3,d0
  878.     add.l    d0,a1
  879.     movem    (a1),d0-d3
  880.     lea    (a0,d0.l),a1
  881.     move    d1,d0
  882.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  883.     lea    (a0,d0.l),a1
  884.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  885.     move    d2,d0
  886.     lea    (a0,d0.l),a1
  887.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  888.     move    d3,d0
  889.     add.l    d0,a0
  890.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  891.     rts
  892.     endc
  893.  
  894. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  895. ;­ Call P61_Music every frame to play the music    ­
  896. ;­      _NOT_ if CIA-version is used!        ­
  897. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  898. ;­              Uses A0-A5/D0-D7        ­
  899. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  900.  
  901. P61_Music
  902.     lea    P61_cn(pc),a3
  903.  
  904.     tst    P61_Play(a3)
  905.     bne.b    P61_ohitaaa
  906.     ifne    CIA
  907.     ifne    system
  908.     move.l    P61_craddr+4(pc),a0
  909.     move.b    P61_tlo2(pc),(a0)
  910.     move.b    P61_thi2(pc),$100(a0)
  911.     endc
  912.     endc
  913.     rts
  914.  
  915. P61_ohitaaa
  916.     ifne    fade
  917.     pea    P61_mfade(pc)
  918.     endc
  919.  
  920.     moveq    #Channel_Block_SIZE,d6
  921.     moveq    #16,d7
  922.  
  923.     move    (a3),d4
  924.     addq    #1,d4
  925.     cmp    P61_speed(pc),d4
  926.     beq    P61_playtime
  927.  
  928.     move    d4,(a3)
  929.  
  930. P61_delay
  931.     ifne    CIA
  932.     ifne    system
  933.     move.l    P61_craddr+4(pc),a0
  934.     move.b    P61_tlo2(pc),(a0)
  935.     move.b    P61_thi2(pc),$100(a0)
  936.     endc
  937.     endc
  938.  
  939.     lea    P61_temp0(pc),a5
  940.     lea    $a0(a6),a4
  941.  
  942.     moveq    #channels-1,d5
  943. P61_lopas
  944.     tst    P61_OnOff(a5)
  945.     beq    P61_contfxdone
  946.     moveq    #$f,d0
  947.     and    (a5),d0
  948.     ifeq    opt020
  949.     add    d0,d0
  950.     move    P61_jtab2(pc,d0),d0
  951.     else
  952.     move    P61_jtab2(pc,d0*2),d0
  953.     endc
  954.     jmp    P61_jtab2(pc,d0)
  955.  
  956. P61_jtab2
  957.     dc    P61_contfxdone-P61_jtab2
  958.  
  959.     ifne    P61_pu
  960.     dc    P61_portup-P61_jtab2
  961.     else
  962.     dc    P61_contfxdone-P61_jtab2
  963.     endc
  964.  
  965.     ifne    P61_pd
  966.     dc    P61_portdwn-P61_jtab2
  967.     else
  968.     dc    P61_contfxdone-P61_jtab2
  969.     endc
  970.  
  971.     ifne    P61_tp
  972.     dc    P61_toneport-P61_jtab2
  973.     else
  974.     dc    P61_contfxdone-P61_jtab2
  975.     endc
  976.  
  977.     ifne    P61_vib
  978.     dc    P61_vib2-P61_jtab2
  979.     else
  980.     dc    P61_contfxdone-P61_jtab2
  981.     endc
  982.  
  983.     ifne    P61_tpvs
  984.     dc    P61_tpochvslide-P61_jtab2
  985.     else
  986.     dc    P61_contfxdone-P61_jtab2
  987.     endc
  988.  
  989.     ifne    P61_vbvs
  990.     dc    P61_vibochvslide-P61_jtab2
  991.     else
  992.     dc    P61_contfxdone-P61_jtab2
  993.     endc
  994.  
  995.     ifne    P61_tre
  996.     dc    P61_tremo-P61_jtab2
  997.     else
  998.     dc    P61_contfxdone-P61_jtab2
  999.     endc
  1000.  
  1001.     ifne    P61_arp
  1002.     dc    P61_arpeggio-P61_jtab2
  1003.     else
  1004.     dc    P61_contfxdone-P61_jtab2
  1005.     endc
  1006.  
  1007.     dc    P61_contfxdone-P61_jtab2
  1008.  
  1009.     ifne    P61_vs
  1010.     dc    P61_volslide-P61_jtab2
  1011.     else
  1012.     dc    P61_contfxdone-P61_jtab2
  1013.     endc
  1014.  
  1015.     dc    P61_contfxdone-P61_jtab2
  1016.     dc    P61_contfxdone-P61_jtab2
  1017.     dc    P61_contfxdone-P61_jtab2
  1018.  
  1019.     ifne    P61_ec
  1020.     dc    P61_contecommands-P61_jtab2
  1021.     else
  1022.     dc    P61_contfxdone-P61_jtab2
  1023.     endc
  1024.     dc    P61_contfxdone-P61_jtab2
  1025.  
  1026.     ifne    P61_ec
  1027. P61_contecommands
  1028.     move.b    P61_Info(a5),d0
  1029.     and    #$f0,d0
  1030.     lsr    #3,d0
  1031.     move    P61_etab2(pc,d0),d0
  1032.     jmp    P61_etab2(pc,d0)
  1033.  
  1034. P61_etab2
  1035.     dc    P61_contfxdone-P61_etab2
  1036.  
  1037.     ifne    P61_fsu
  1038.     dc    P61_fineup2-P61_etab2
  1039.     else
  1040.     dc    P61_contfxdone-P61_etab2
  1041.     endc
  1042.  
  1043.     ifne    P61_fsd
  1044.     dc    P61_finedwn2-P61_etab2
  1045.     else
  1046.     dc    P61_contfxdone-P61_etab2
  1047.     endc
  1048.  
  1049.     dc    P61_contfxdone-P61_etab2
  1050.     dc    P61_contfxdone-P61_etab2
  1051.  
  1052.     dc    P61_contfxdone-P61_etab2
  1053.     dc    P61_contfxdone-P61_etab2
  1054.  
  1055.     dc    P61_contfxdone-P61_etab2
  1056.     dc    P61_contfxdone-P61_etab2
  1057.  
  1058.     ifne    P61_rt
  1059.     dc    P61_retrig-P61_etab2
  1060.     else
  1061.     dc    P61_contfxdone-P61_etab2
  1062.     endc
  1063.  
  1064.     ifne    P61_fvu
  1065.     dc    P61_finevup2-P61_etab2
  1066.     else
  1067.     dc    P61_contfxdone-P61_etab2
  1068.     endc
  1069.  
  1070.     ifne    P61_fvd
  1071.     dc    P61_finevdwn2-P61_etab2
  1072.     else
  1073.     dc    P61_contfxdone-P61_etab2
  1074.     endc
  1075.  
  1076.     ifne    P61_nc
  1077.     dc    P61_notecut-P61_etab2
  1078.     else
  1079.     dc    P61_contfxdone-P61_etab2
  1080.     endc
  1081.  
  1082.     ifne    P61_nd
  1083.     dc    P61_notedelay-P61_etab2
  1084.     else
  1085.     dc    P61_contfxdone-P61_etab2
  1086.     endc
  1087.  
  1088.     dc    P61_contfxdone-P61_etab2
  1089.     dc    P61_contfxdone-P61_etab2
  1090.     endc
  1091.  
  1092.     ifne    P61_fsu
  1093. P61_fineup2
  1094.     tst    (a3)
  1095.     bne    P61_contfxdone
  1096.     moveq    #$f,d0
  1097.     and.b    P61_Info(a5),d0
  1098.     sub    d0,P61_Period(a5)
  1099.     moveq    #113,d0
  1100.     cmp    P61_Period(a5),d0
  1101.     ble.b    .jup
  1102.     move    d0,P61_Period(a5)
  1103. .jup    move    P61_Period(a5),6(a4)
  1104.     bra    P61_contfxdone
  1105.     endc
  1106.  
  1107.     ifne    P61_fsd
  1108. P61_finedwn2
  1109.     tst    (a3)
  1110.     bne    P61_contfxdone
  1111.     moveq    #$f,d0
  1112.     and.b    P61_Info(a5),d0
  1113.     add    d0,P61_Period(a5)
  1114.     cmp    #856,P61_Period(a5)
  1115.     ble.b    .jup
  1116.     move    #856,P61_Period(a5)
  1117. .jup    move    P61_Period(a5),6(a4)
  1118.     bra    P61_contfxdone
  1119.     endc
  1120.  
  1121.     ifne    P61_fvu
  1122. P61_finevup2
  1123.     tst    (a3)
  1124.     bne    P61_contfxdone
  1125.     moveq    #$f,d0
  1126.     and.b    P61_Info(a5),d0
  1127.     add    d0,P61_Volume(a5)
  1128.     moveq    #64,d0
  1129.     cmp    P61_Volume(a5),d0
  1130.     bge.b    .jup
  1131.     move    d0,P61_Volume(a5)
  1132. .jup    move    P61_Volume(a5),8(a4)
  1133.     bra    P61_contfxdone
  1134.     endc
  1135.  
  1136.     ifne    P61_fvd
  1137. P61_finevdwn2
  1138.     tst    (a3)
  1139.     bne    P61_contfxdone
  1140.     moveq    #$f,d0
  1141.     and.b    P61_Info(a5),d0
  1142.     sub    d0,P61_Volume(a5)
  1143.     bpl.b    .jup
  1144.     clr    P61_Volume(a5)
  1145. .jup    move    P61_Volume(a5),8(a4)
  1146.     bra    P61_contfxdone
  1147.     endc
  1148.  
  1149.     ifne    P61_nc
  1150. P61_notecut
  1151.     moveq    #$f,d0
  1152.     and.b    P61_Info(a5),d0
  1153.     cmp    (a3),d0
  1154.     bne    P61_contfxdone
  1155.     ifeq    fade
  1156.     clr    8(a4)
  1157.     else
  1158.     clr    P61_Shadow(a5)
  1159.     endc
  1160.     clr    P61_Volume(a5)
  1161.     bra    P61_contfxdone
  1162.     endc
  1163.  
  1164.     ifne    P61_nd
  1165. P61_notedelay
  1166.     moveq    #$f,d0
  1167.     and.b    P61_Info(a5),d0
  1168.     cmp    (a3),d0
  1169.     bne    P61_contfxdone
  1170.  
  1171.     moveq    #$7e,d0
  1172.     and.b    (a5),d0
  1173.     beq    P61_contfxdone
  1174.     move    P61_DMABit(a5),d0
  1175.     move    d0,$96(a6)
  1176.     or    d0,P61_dma(a3)
  1177.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1178.     move.l    (a1)+,(a4)+            ;Pointer
  1179.     move    (a1),(a4)+            ;Length
  1180.     move    P61_Period(a5),(a4)
  1181.     subq.l    #6,a4
  1182.  
  1183.     ifeq    system
  1184.     lea    P61_dmason(pc),a1
  1185.     move.l    P61_vektori(pc),a0
  1186.     move.l    a1,(a0)
  1187.     move.b    #$f0,$bfd600
  1188.     move.b    #$01,$bfd700
  1189.     move.b    #$19,$bfdf00
  1190.     else
  1191.     move    #1,P61_server(a3)
  1192.     move.l    P61_craddr+4(pc),a1
  1193.     move.b    #$f0,(a1)
  1194.     move.b    #1,$100(a1)
  1195.     endc
  1196.     bra    P61_contfxdone
  1197.     endc
  1198.  
  1199.     ifne    P61_rt
  1200. P61_retrig
  1201.     subq    #1,P61_RetrigCount(a5)
  1202.     bne    P61_contfxdone
  1203.     move    P61_DMABit(a5),d0
  1204.     move    d0,$96(a6)
  1205.     or    d0,P61_dma(a3)
  1206.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1207.     move.l    (a1)+,(a4)            ;Pointer
  1208.     move    (a1),4(a4)            ;Length
  1209.  
  1210.     ifeq    system
  1211.     lea    P61_dmason(pc),a1
  1212.     move.l    P61_vektori(pc),a0
  1213.     move.l    a1,(a0)
  1214.     move.b    #$f0,$bfd600
  1215.     move.b    #$01,$bfd700
  1216.     move.b    #$19,$bfdf00
  1217.     else
  1218.     move    #1,P61_server(a3)
  1219.     move.l    P61_craddr+4(pc),a1
  1220.     move.b    #$f0,(a1)
  1221.     move.b    #1,$100(a1)
  1222.     endc
  1223.  
  1224.     moveq    #$f,d0
  1225.     and.b    P61_Info(a5),d0
  1226.     move    d0,P61_RetrigCount(a5)
  1227.     bra    P61_contfxdone
  1228.     endc
  1229.  
  1230.     ifne    P61_arp
  1231. P61_arplist
  1232.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1233.  
  1234. P61_arpeggio
  1235.     move    (a3),d0
  1236.     move.b    P61_arplist(pc,d0),d0
  1237.     beq.b    .arp0
  1238.     subq.b    #1,d0
  1239.     beq.b    P61_arp1
  1240.     moveq    #$f,d0
  1241.     and.b    P61_Info(a5),d0
  1242.     bra.b    P61_arp3
  1243.  
  1244. .arp0    move    P61_Note(a5),d0
  1245.     move    P61_periods(pc,d0),6(a4)
  1246.     bra    P61_contfxdone
  1247. P61_arp1
  1248.     move.b    P61_Info(a5),d0
  1249.     lsr    #4,d0
  1250. P61_arp3
  1251.     add    d0,d0
  1252.     add    P61_Note(a5),d0
  1253.     move    P61_periods(pc,d0),6(a4)
  1254.     bra    P61_contfxdone
  1255.     endc
  1256.  
  1257. P61_periods
  1258.     ifne    P61_ft
  1259.     incbin    periods
  1260.     else
  1261.     incbin    periods.nft
  1262.     endc
  1263.  
  1264.     ifne    P61_vs
  1265. P61_volslide
  1266.     move.b    P61_Info(a5),d0
  1267.     sub.b    d0,P61_Volume+1(a5)
  1268.     bpl.b    .test
  1269.     clr    P61_Volume(a5)
  1270.     ifeq    fade
  1271.     clr    8(a4)
  1272.     else
  1273.     clr    P61_Shadow(a5)
  1274.     endc
  1275.     bra    P61_contfxdone
  1276. .test    moveq    #64,d0
  1277.     cmp    P61_Volume(a5),d0
  1278.     bge.b    .ncs
  1279.     move    d0,P61_Volume(a5)
  1280.     ifeq    fade
  1281.     move    d0,8(a4)
  1282.     else
  1283.     move    d0,P61_Shadow(a5)
  1284.     endc
  1285.     bra.b    P61_contfxdone
  1286. .ncs    ifeq    fade
  1287.     move    P61_Volume(a5),8(a4)
  1288.     else
  1289.     move    P61_Volume(a5),P61_Shadow(a5)
  1290.     endc
  1291.     bra.b    P61_contfxdone
  1292.     endc
  1293.  
  1294.     ifne    P61_tpvs
  1295. P61_tpochvslide
  1296.     move.b    P61_Info(a5),d0
  1297.     sub.b    d0,P61_Volume+1(a5)
  1298.     bpl.b    .test
  1299.     clr    P61_Volume(a5)
  1300.     ifeq    fade
  1301.     clr    8(a4)
  1302.     else
  1303.     clr    P61_Shadow(a5)
  1304.     endc
  1305.     bra.b    P61_toneport
  1306. .test    moveq    #64,d0
  1307.     cmp    P61_Volume(a5),d0
  1308.     bge.b    .ncs
  1309.     move    d0,P61_Volume(a5)
  1310. .ncs    ifeq    fade
  1311.     move    P61_Volume(a5),8(a4)
  1312.     else
  1313.     move    P61_Volume(a5),P61_Shadow(a5)
  1314.     endc
  1315.     endc
  1316.  
  1317.     ifne    P61_tp
  1318. P61_toneport
  1319.     move    P61_ToPeriod(a5),d0
  1320.     beq.b    P61_contfxdone
  1321.     move    P61_TPSpeed(a5),d1
  1322.     cmp    P61_Period(a5),d0
  1323.     blt.b    .topoup
  1324.  
  1325.     add    d1,P61_Period(a5)
  1326.     cmp    P61_Period(a5),d0
  1327.     bgt.b    P61_toposetper
  1328.     move    d0,P61_Period(a5)
  1329.     clr    P61_ToPeriod(a5)
  1330.     move    d0,6(a4)
  1331.     bra.b    P61_contfxdone
  1332.  
  1333. .topoup
  1334.     sub    d1,P61_Period(a5)
  1335.     cmp    P61_Period(a5),d0
  1336.     blt.b    P61_toposetper
  1337.     move    d0,P61_Period(a5)
  1338.     clr    P61_ToPeriod(a5)
  1339. P61_toposetper
  1340.     move    P61_Period(a5),6(a4)
  1341.     else
  1342.     nop
  1343.     endc
  1344.  
  1345. P61_contfxdone
  1346.     ifne    P61_il
  1347.     bsr    P61_funk2
  1348.     endc
  1349.  
  1350.     add.l    d6,a5
  1351.     add.l    d7,a4
  1352.     dbf    d5,P61_lopas
  1353.  
  1354.     cmp    P61_speed2(pc),d4
  1355.     beq.b    P61_preplay
  1356.     rts
  1357.  
  1358.     ifne    P61_pu
  1359. P61_portup
  1360.     moveq    #0,D0
  1361.     move.b    P61_Info(a5),d0
  1362.     sub    d0,P61_Period(a5)
  1363.     moveq    #113,d0
  1364.     cmp    P61_Period(a5),d0
  1365.     ble.b    .skip
  1366.     move    d0,P61_Period(a5)
  1367.     move    d0,6(a4)
  1368.     bra.b    P61_contfxdone
  1369. .skip
  1370.     move    P61_Period(a5),6(a4)
  1371.     bra.b    P61_contfxdone
  1372.     endc
  1373.  
  1374.     ifne    P61_pd
  1375. P61_portdwn
  1376.     moveq    #0,d0
  1377.     move.b    P61_Info(a5),d0
  1378.     add    d0,P61_Period(a5)
  1379.     cmp    #856,P61_Period(a5)
  1380.     ble.b    .skip
  1381.     move    #856,d0
  1382.     move    d0,P61_Period(a5)
  1383.     move    d0,6(a4)
  1384.     bra.b    P61_contfxdone
  1385. .skip
  1386.     move    P61_Period(a5),6(a4)
  1387.     bra.b    P61_contfxdone
  1388.     endc
  1389.  
  1390.     ifne    P61_pde
  1391. P61_return
  1392.     rts
  1393.  
  1394. P61_preplay
  1395.     tst    P61_pdflag(a3)
  1396.     bne.b    P61_return
  1397.     else
  1398. P61_preplay
  1399.     endc
  1400.  
  1401.     lea    P61_temp0(pc),a5
  1402.     lea    P61_Samples-16(pc),a0
  1403.  
  1404.     moveq    #channels-1,d5
  1405. P61_loaps
  1406.     ifne    P61_pl
  1407.     lea    P61_TData(a5),a1
  1408.     move    2(a5),(a1)+
  1409.     move.l    P61_ChaPos(a5),(a1)+
  1410.     move.l    P61_TempPos(a5),(a1)+
  1411.     move    P61_TempLen(a5),(a1)
  1412.     endc
  1413.  
  1414.     move.b    P61_Pack(a5),d0
  1415.     and.b    #$3f,d0
  1416.     beq.b    P61_takeone
  1417.  
  1418.     tst.b    P61_Pack(a5)
  1419.     bmi.b    .keepsame
  1420.  
  1421.     subq.b    #1,P61_Pack(a5)
  1422.     clr    P61_OnOff(a5)            ; Empty row
  1423.     add.l    d6,a5
  1424.     dbf    d5,P61_loaps
  1425.     rts
  1426.  
  1427. .keepsame
  1428.     subq.b    #1,P61_Pack(a5)
  1429.     bra    P61_dko
  1430.  
  1431. P61_takeone
  1432.     tst.b    P61_TempLen+1(a5)
  1433.     beq    P61_takenorm
  1434.  
  1435.     subq.b    #1,P61_TempLen+1(a5)
  1436.     move.l    P61_TempPos(a5),a2
  1437.  
  1438. P61_jedi
  1439.     move.b    (a2)+,d0
  1440.     moveq    #%01100000,d1
  1441.     and.b    d0,d1
  1442.     cmp.b    #%01100000,d1
  1443.     bne.b    .all
  1444.  
  1445.     moveq    #%01110000,d1
  1446.     and.b    d0,d1
  1447.     cmp.b    #%01110000,d1
  1448.     bne.b    .cmd
  1449.  
  1450.     moveq    #%01111000,d1
  1451.     and.b    d0,d1
  1452.     cmp.b    #%01111000,d1
  1453.     bne.b    .note
  1454.  
  1455. .empty    clr    P61_OnOff(a5)            ; Empty row
  1456.     clr    (a5)+
  1457.     clr.b    (a5)+
  1458.     tst.b    d0
  1459.     bpl.b    .ex
  1460.     move.b    (a2)+,(a5)            ; Compression info
  1461.     bra.b    .ex
  1462.  
  1463. .all    move.b    d0,(a5)+
  1464.     ifeq    opt020
  1465.     move.b    (a2)+,(a5)+
  1466.     move.b    (a2)+,(a5)+
  1467.     else
  1468.     move    (a2)+,(a5)+
  1469.     endc
  1470.     tst.b    d0
  1471.     bpl.b    .ex
  1472.     move.b    (a2)+,(a5)            ; Compression info
  1473.     bra.b    .ex
  1474.  
  1475. .cmd    moveq    #$f,d1
  1476.     and    d0,d1
  1477.     move    d1,(a5)+            ; cmd
  1478.     move.b    (a2)+,(a5)+            ; info
  1479.     tst.b    d0
  1480.     bpl.b    .ex
  1481.     move.b    (a2)+,(a5)            ; Compression info
  1482.     bra.b    .ex
  1483.  
  1484. .note    moveq    #7,d1
  1485.     and    d0,d1
  1486.     lsl    #8,d1
  1487.     move.b    (a2)+,d1
  1488.     lsl    #4,d1
  1489.     move    d1,(a5)+
  1490.     clr.b    (a5)+    
  1491.     tst.b    d0
  1492.     bpl.b    .ex
  1493.     move.b    (a2)+,(a5)            ; Compression info
  1494. .ex    subq.l    #3,a5
  1495.     move.l    a2,P61_TempPos(a5)
  1496.     bra    P61_dko
  1497.  
  1498.  
  1499. P61_takenorm
  1500.     move.l    P61_ChaPos(a5),a2
  1501.  
  1502.     move.b    (a2)+,d0
  1503.     moveq    #%01100000,d1
  1504.     and.b    d0,d1
  1505.     cmp.b    #%01100000,d1
  1506.     bne.b    .all
  1507.  
  1508.     moveq    #%01110000,d1
  1509.     and.b    d0,d1
  1510.     cmp.b    #%01110000,d1
  1511.     bne.b    .cmd
  1512.  
  1513.     moveq    #%01111000,d1
  1514.     and.b    d0,d1
  1515.     cmp.b    #%01111000,d1
  1516.     bne.b    .note
  1517.  
  1518. .empty    clr    P61_OnOff(a5)            ; Empty row
  1519.     clr    (a5)+
  1520.     clr.b    (a5)+
  1521.     tst.b    d0
  1522.     bpl.b    .proccomp
  1523.     move.b    (a2)+,(a5)            ; Compression info
  1524.     bra.b    .proccomp
  1525.  
  1526.  
  1527. .all    move.b    d0,(a5)+
  1528.     ifeq    opt020
  1529.     move.b    (a2)+,(a5)+
  1530.     move.b    (a2)+,(a5)+
  1531.     else
  1532.     move    (a2)+,(a5)+
  1533.     endc
  1534.     tst.b    d0
  1535.     bpl.b    .proccomp
  1536.     move.b    (a2)+,(a5)            ; Compression info
  1537.     bra.b    .proccomp
  1538.  
  1539. .cmd    moveq    #$f,d1
  1540.     and    d0,d1
  1541.     move    d1,(a5)+            ; cmd
  1542.     move.b    (a2)+,(a5)+            ; info
  1543.     tst.b    d0
  1544.     bpl.b    .proccomp
  1545.     move.b    (a2)+,(a5)            ; Compression info
  1546.     bra.b    .proccomp
  1547.  
  1548. .note    moveq    #7,d1
  1549.     and    d0,d1
  1550.     lsl    #8,d1
  1551.     move.b    (a2)+,d1
  1552.     lsl    #4,d1
  1553.     move    d1,(a5)+
  1554.     clr.b    (a5)+    
  1555.     tst.b    d0
  1556.     bpl.b    .proccomp
  1557.     move.b    (a2)+,(a5)            ; Compression info
  1558.  
  1559. .proccomp
  1560.     subq.l    #3,a5
  1561.     move.l    a2,P61_ChaPos(a5)
  1562.  
  1563.     tst.b    d0
  1564.     bpl.b    P61_dko
  1565.  
  1566.     move.b    3(a5),d0
  1567.     move.b    d0,d1
  1568.     and    #%11000000,d1
  1569.     beq.b    P61_dko                ; Empty datas
  1570.     cmp.b    #%10000000,d1
  1571.     beq.b    P61_dko                ; Same datas
  1572.  
  1573.     clr.b    3(a5)
  1574.     and    #$3f,d0
  1575.     move.b    d0,P61_TempLen+1(a5)
  1576.  
  1577.     cmp.b    #%11000000,d1
  1578.     beq.b    .bit16                ; 16-bit
  1579.  
  1580.     moveq    #0,d0                ; 8-bit
  1581.     move.b    (a2)+,d0
  1582.     move.l    a2,P61_ChaPos(a5)
  1583.     sub.l    d0,a2
  1584.     bra    P61_jedi
  1585.  
  1586. .bit16    moveq    #0,d0
  1587.     ifeq    opt020
  1588.     move.b    (a2)+,d0
  1589.     lsl    #8,d0
  1590.     move.b    (a2)+,d0
  1591.     else
  1592.     move    (a2)+,d0
  1593.     endc
  1594.  
  1595.     move.l    a2,P61_ChaPos(a5)
  1596.     sub.l    d0,a2
  1597.     bra    P61_jedi
  1598.  
  1599.  
  1600. P61_dko    st    P61_OnOff(a5)
  1601.     move    (a5),d0
  1602.     and    #$1f0,d0
  1603.     beq.b    .koto
  1604.     lea    (a0,d0),a1
  1605.     move.l    a1,P61_Sample(a5)
  1606.     ifne    P61_ft
  1607.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1608.     else
  1609.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1610.     endc
  1611.     ifne    P61_il
  1612.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1613.     endc
  1614.     ifne    P61_sof
  1615.     clr    P61_Offset(a5)
  1616.     endc
  1617.  
  1618. .koto    add.l    d6,a5
  1619.     dbf    d5,P61_loaps
  1620.     rts
  1621.  
  1622. P61_playtime
  1623.     clr    (a3)
  1624.  
  1625.     ifne    P61_pde
  1626.     tst    P61_pdelay(a3)
  1627.     beq.b    .djdj
  1628.     subq    #1,P61_pdelay(a3)
  1629.     bne    P61_delay
  1630.     tst    P61_speedis1(a3)
  1631.     bne    P61_delay
  1632.     clr    P61_pdflag(a3)
  1633.     bra    P61_delay
  1634. .djdj
  1635.     endc
  1636.  
  1637.     clr    P61_pdflag(a3)
  1638.  
  1639.     tst    P61_speedis1(a3)
  1640.     beq.b    .mo
  1641.     bsr    P61_preplay
  1642.  
  1643. .mo    lea    P61_temp0(pc),a5
  1644.     lea    $a0(a6),a4
  1645.  
  1646.     ifeq    system
  1647.     lea    P61_dmason(pc),a1
  1648.     move.l    P61_vektori(pc),a0
  1649.     move.l    a1,(a0)
  1650.     move.b    #$f0,$bfd600
  1651.     move.b    #$01,$bfd700
  1652.     move.b    #$19,$bfdf00
  1653.     else
  1654.     move    #1,P61_server(a3)
  1655.     move.l    P61_craddr+4(pc),a1
  1656.     move.b    #$f0,(a1)
  1657.     move.b    #1,$100(a1)
  1658.     endc
  1659.  
  1660.     lea    P61_periods(pc),a2
  1661.  
  1662.     moveq    #0,d4
  1663.     moveq    #channels-1,d5
  1664. P61_los    tst    P61_OnOff(a5)
  1665.     beq    P61_nocha
  1666.  
  1667.     moveq    #$f,d0
  1668.     and    (a5),d0
  1669.     lea    P61_jtab(pc),a1
  1670.     add    d0,d0
  1671.     add.l    d0,a1
  1672.     add    (a1),a1
  1673.     jmp    (a1)
  1674.  
  1675. P61_fxdone
  1676.     moveq    #$7e,d0
  1677.     and.b    (a5),d0
  1678.     beq.b    P61_nocha
  1679.     ifne    P61_vib
  1680.     clr.b    P61_VibPos(a5)
  1681.     endc
  1682.     ifne    P61_tre
  1683.     clr.b    P61_TrePos(a5)
  1684.     endc
  1685.  
  1686.      ifne    P61_ft
  1687.     add    P61_Fine(a5),d0
  1688.     endc
  1689.     move    d0,P61_Note(a5)
  1690.     move    (a2,d0),P61_Period(a5)
  1691.  
  1692. P61_zample
  1693.     ifne    P61_sof
  1694.     tst    P61_Offset(a5)
  1695.     bne    P61_pek
  1696.     endc
  1697.  
  1698.     or    P61_DMABit(a5),d4
  1699.     move    d4,$96(a6)
  1700.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1701.     move.l    (a1)+,(a4)            ;Pointer
  1702.     move    (a1),4(a4)            ;Length
  1703.  
  1704. P61_nocha
  1705.     ifeq    fade
  1706.     move.l    P61_Period(a5),6(a4)
  1707.     else
  1708.     move    P61_Period(a5),6(a4)
  1709.     move    P61_Volume(a5),P61_Shadow(a5)
  1710.     endc
  1711.  
  1712. P61_skip
  1713.     ifne    P61_il
  1714.     bsr    P61_funk2
  1715.     endc
  1716.  
  1717.     add.l    d6,a5
  1718.     add.l    d7,a4
  1719.     dbf    d5,P61_los
  1720.  
  1721.     move.b    d4,P61_dma+1(a3)
  1722.  
  1723.     ifne    P61_pl
  1724.     tst.b    P61_plflag+1(a3)
  1725.     beq.b    P61_ohittaa
  1726.  
  1727.     lea    P61_temp0(pc),a1
  1728.     lea    P61_looppos(pc),a0
  1729.     moveq    #channels-1,d0
  1730. .talt    move.b    1(a0),3(a1)
  1731.     addq.l    #2,a0
  1732.     move.l    (a0)+,P61_ChaPos(a1)
  1733.     move.l    (a0)+,P61_TempPos(a1)
  1734.     move    (a0)+,P61_TempLen(a1)
  1735.     add.l    d6,a1
  1736.     dbf    d0,.talt
  1737.  
  1738.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1739.     clr.b    P61_plflag+1(a3)
  1740.     moveq    #63,d0
  1741.     sub    P61_rowpos(a3),d0
  1742.     move    d0,P61_CRow(a3)
  1743.     rts
  1744.     endc
  1745.  
  1746. P61_ohittaa
  1747.     subq    #1,P61_rowpos(a3)
  1748.     bmi.b    P61_nextpattern
  1749.     moveq    #63,d0
  1750.     sub    P61_rowpos(a3),d0
  1751.     move    d0,P61_CRow(a3)
  1752.     rts
  1753.  
  1754. P61_nextpattern
  1755.     ifne    P61_pl
  1756.     clr    P61_plflag(a3)
  1757.     endc
  1758.     move.l    P61_patternbase(pc),a4
  1759.     moveq    #63,d0
  1760.     move    d0,P61_rowpos(a3)
  1761.     clr    P61_CRow(a3)
  1762.     move.l    P61_spos(pc),a1
  1763.     addq    #1,P61_Pos(a3)
  1764.     move.b    (a1)+,d0
  1765.     bpl.b    P61_dk
  1766.     move.l    P61_possibase(pc),a1
  1767.     move.b    (a1)+,d0
  1768.     clr    P61_Pos(a3)
  1769. P61_dk    move.l    a1,P61_spos(a3)
  1770.     move    d0,P61_Patt(a3)
  1771.     lsl    #3,d0
  1772.     move.l    P61_positionbase(pc),a1
  1773.     add.l    d0,a1
  1774.  
  1775.     move    (a1)+,d0
  1776.     lea    (a4,d0.l),a2
  1777.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1778.     move    (a1)+,d0
  1779.     lea    (a4,d0.l),a2
  1780.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1781.     move    (a1)+,d0
  1782.     lea    (a4,d0.l),a2
  1783.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1784.     move    (a1),d0
  1785.     add.l    d0,a4
  1786.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1787.     rts
  1788.  
  1789.     ifne    P61_tp
  1790. P61_settoneport
  1791.     move.b    P61_Info(a5),d0
  1792.     beq.b    P61_toponochange
  1793.     move.b    d0,P61_TPSpeed+1(a5)
  1794. P61_toponochange
  1795.     moveq    #$7e,d0
  1796.     and.b    (a5),d0
  1797.     beq    P61_nocha
  1798.     add    P61_Fine(a5),d0
  1799.     move    d0,P61_Note(a5)
  1800.     move    (a2,d0),P61_ToPeriod(a5)
  1801.     bra    P61_nocha
  1802.     endc
  1803.  
  1804.     ifne    P61_sof
  1805. P61_sampleoffse
  1806.     moveq    #0,d1
  1807.     move    #$ff00,d1
  1808.     and    2(a5),d1
  1809.     bne.b    .deq
  1810.     move    P61_LOffset(a5),d1
  1811. .deq    move    d1,P61_LOffset(a5)
  1812.     add    d1,P61_Offset(a5)
  1813.  
  1814.     moveq    #$7e,d0
  1815.     and.b    (a5),d0
  1816.     beq    P61_nocha
  1817.  
  1818.     move    P61_Offset(a5),d2
  1819.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1820.     move    d2,d1
  1821.  
  1822.     ifne    P61_vib
  1823.     clr.b    P61_VibPos(a5)
  1824.     endc
  1825.     ifne    P61_tre
  1826.     clr.b    P61_TrePos(a5)
  1827.     endc
  1828.  
  1829.     ifne    P61_ft
  1830.     add    P61_Fine(a5),d0
  1831.     endc
  1832.     move    d0,P61_Note(a5)
  1833.     move    (a2,d0),P61_Period(a5)
  1834.     bra.b    P61_hup
  1835.  
  1836. P61_pek    moveq    #0,d1
  1837.     move    P61_Offset(a5),d1
  1838. P61_hup    or    P61_DMABit(a5),d4
  1839.     move    d4,$96(a6)
  1840.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1841.     move.l    (a1)+,d0
  1842.     add.l    d1,d0
  1843.     move.l    d0,(a4)                ;Pointer
  1844.     lsr    #1,d1
  1845.     move    (a1),d0
  1846.     sub    d1,d0
  1847.     bpl.b    P61_offok
  1848.     move.l    -4(a1),(a4)            ;Pointer is over the end
  1849.     moveq    #1,d0
  1850. P61_offok
  1851.     move    d0,4(a4)            ;Length
  1852.     bra    P61_nocha
  1853.     endc
  1854.  
  1855.     ifne    P61_vl
  1856. P61_volum
  1857.     move.b    P61_Info(a5),P61_Volume+1(a5)
  1858.     bra    P61_fxdone
  1859.     endc
  1860.  
  1861.     ifne    P61_pj
  1862. P61_posjmp
  1863.     moveq    #0,d0
  1864.     move.b    P61_Info(a5),d0
  1865.     cmp    P61_slen(a3),d0
  1866.     blo.b    .e
  1867.     moveq    #0,d0
  1868. .e    move    d0,P61_Pos(a3)
  1869.     add.l    P61_possibase(pc),d0
  1870.     move.l    d0,P61_spos(a3)
  1871.     endc
  1872.  
  1873.     ifne    P61_pb
  1874. P61_pattbreak
  1875.     moveq    #64,d0
  1876.     move    d0,P61_rowpos(a3)
  1877.     clr    P61_CRow(a3)
  1878.     move.l    P61_spos(pc),a1
  1879.     move.l    P61_patternbase(pc),a0
  1880.     addq    #1,P61_Pos(a3)
  1881.     move.b    (a1)+,d0
  1882.     bpl.b    P61_dk2
  1883.     move.l    P61_possibase(pc),a1
  1884.     move.b    (a1)+,d0
  1885.     clr    P61_Pos(a3)
  1886. P61_dk2    move.l    a1,P61_spos(a3)
  1887.     move.l    P61_positionbase(pc),a1
  1888.     move    d0,P61_Patt(a3)
  1889.     lsl    #3,d0
  1890.     add.l    d0,a1
  1891.     movem    (a1),d0-d3
  1892.     lea    (a0,d0.l),a1
  1893.     move    d1,d0
  1894.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  1895.     lea    (a0,d0.l),a1
  1896.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  1897.     move    d2,d0
  1898.     lea    (a0,d0.l),a1
  1899.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  1900.     move    d3,d0
  1901.     add.l    d0,a0
  1902.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1903.     bra    P61_fxdone
  1904.     endc
  1905.  
  1906.     ifne    P61_vib
  1907. P61_vibrato
  1908.     move.b    P61_Info(a5),d0
  1909.     beq    P61_fxdone
  1910.     move.b    d0,d1
  1911.     move.b    P61_VibCmd(a5),d2
  1912.     and.b    #$f,d0
  1913.     beq.b    P61_vibskip
  1914.     and.b    #$f0,d2
  1915.     or.b    d0,d2
  1916. P61_vibskip
  1917.     and.b    #$f0,d1
  1918.     beq.b    P61_vibskip2
  1919.     and.b    #$f,d2
  1920.     or.b    d1,d2
  1921. P61_vibskip2
  1922.     move.b    d2,P61_VibCmd(a5)
  1923.     bra    P61_fxdone
  1924.     endc
  1925.  
  1926.     ifne    P61_tre
  1927. P61_settremo
  1928.     move.b    P61_Info(a5),d0
  1929.     beq    P61_fxdone
  1930.     move.b    d0,d1
  1931.     move.b    P61_TreCmd(a5),d2
  1932.     moveq    #$f,d3
  1933.     and.b    d3,d0
  1934.     beq.b    P61_treskip
  1935.     and.b    #$f0,d2
  1936.     or.b    d0,d2
  1937. P61_treskip
  1938.     and.b    #$f0,d1
  1939.     beq.b    P61_treskip2
  1940.     and.b    d3,d2
  1941.     or.b    d1,d2
  1942. P61_treskip2
  1943.     move.b    d2,P61_TreCmd(a5)
  1944.     bra    P61_fxdone
  1945.     endc
  1946.  
  1947.     ifne    P61_ec
  1948. P61_ecommands
  1949.     move.b    P61_Info(a5),d0
  1950.     and.b    #$f0,d0
  1951.     lsr    #3,d0
  1952.     move    P61_etab(pc,d0),d0
  1953.     jmp    P61_etab(pc,d0)
  1954.  
  1955. P61_etab
  1956.     ifne    P61_fi
  1957.     dc    P61_filter-P61_etab
  1958.     else
  1959.     dc    P61_fxdone-P61_etab
  1960.     endc
  1961.  
  1962.     ifne    P61_fsu
  1963.     dc    P61_fineup-P61_etab
  1964.     else
  1965.     dc    P61_fxdone-P61_etab
  1966.     endc
  1967.  
  1968.     ifne    P61_fsd
  1969.     dc    P61_finedwn-P61_etab
  1970.     else
  1971.     dc    P61_fxdone-P61_etab
  1972.     endc
  1973.  
  1974.     dc    P61_fxdone-P61_etab
  1975.     dc    P61_fxdone-P61_etab
  1976.  
  1977.     ifne    P61_sft
  1978.     dc    P61_setfinetune-P61_etab
  1979.     else
  1980.     dc    P61_fxdone-P61_etab
  1981.     endc
  1982.  
  1983.     ifne    P61_pl
  1984.     dc    P61_patternloop-P61_etab
  1985.     else
  1986.     dc    P61_fxdone-P61_etab
  1987.     endc
  1988.  
  1989.     dc    P61_fxdone-P61_etab
  1990.  
  1991.     ifne    P61_timing
  1992.     dc    P61_sete8-P61_etab
  1993.     else
  1994.     dc    P61_fxdone-P61_etab
  1995.     endc
  1996.  
  1997.     ifne    P61_rt
  1998.     dc    P61_setretrig-P61_etab
  1999.     else
  2000.     dc    P61_fxdone-P61_etab
  2001.     endc
  2002.  
  2003.     ifne    P61_fvu
  2004.     dc    P61_finevup-P61_etab
  2005.     else
  2006.     dc    P61_fxdone-P61_etab
  2007.     endc
  2008.  
  2009.     ifne    P61_fvd
  2010.     dc    P61_finevdwn-P61_etab
  2011.     else
  2012.     dc    P61_fxdone-P61_etab
  2013.     endc
  2014.  
  2015.     dc    P61_fxdone-P61_etab
  2016.  
  2017.     ifne    P61_nd
  2018.     dc    P61_ndelay-P61_etab
  2019.     else
  2020.     dc    P61_fxdone-P61_etab
  2021.     endc
  2022.  
  2023.     ifne    P61_pde
  2024.     dc    P61_pattdelay-P61_etab
  2025.     else
  2026.     dc    P61_fxdone-P61_etab
  2027.     endc
  2028.  
  2029.     ifne    P61_il
  2030.     dc    P61_funk-P61_etab
  2031.     else
  2032.     dc    P61_fxdone-P61_etab
  2033.     endc
  2034.     endc
  2035.  
  2036.     ifne    P61_fi
  2037. P61_filter
  2038.     move.b    P61_Info(a5),d0
  2039.     and.b    #$fd,$bfe001
  2040.     or.b    d0,$bfe001
  2041.     bra    P61_fxdone
  2042.     endc
  2043.  
  2044.     ifne    P61_fsu
  2045. P61_fineup
  2046.     P61_getnote
  2047.  
  2048.     moveq    #$f,d0
  2049.     and.b    P61_Info(a5),d0
  2050.     sub    d0,P61_Period(a5)
  2051.     moveq    #113,d0
  2052.     cmp    P61_Period(a5),d0
  2053.     ble.b    .jup
  2054.     move    d0,P61_Period(a5)
  2055. .jup    moveq    #$7e,d0
  2056.     and.b    (a5),d0
  2057.     bne    P61_zample
  2058.     bra    P61_nocha
  2059.     endc
  2060.  
  2061.     ifne    P61_fsd
  2062. P61_finedwn
  2063.     P61_getnote
  2064.  
  2065.     moveq    #$f,d0
  2066.     and.b    P61_Info(a5),d0
  2067.     add    d0,P61_Period(a5)
  2068.     cmp    #856,P61_Period(a5)
  2069.     ble.b    .jup
  2070.     move    #856,P61_Period(a5)
  2071. .jup    moveq    #$7e,d0
  2072.     and.b    (a5),d0
  2073.     bne    P61_zample
  2074.     bra    P61_nocha
  2075.     endc
  2076.  
  2077.     ifne    P61_sft
  2078. P61_setfinetune
  2079.     moveq    #$f,d0
  2080.     and.b    P61_Info(a5),d0
  2081.     ifeq    opt020
  2082.     add    d0,d0
  2083.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2084.     else
  2085.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2086.     endc
  2087.     bra    P61_fxdone
  2088.  
  2089. P61_mulutab
  2090.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2091.     endc
  2092.  
  2093.     ifne    P61_pl
  2094. P61_patternloop
  2095.     moveq    #$f,d0
  2096.     and.b    P61_Info(a5),d0
  2097.     beq.b    P61_setloop
  2098.  
  2099.     tst.b    P61_plflag(a3)
  2100.     bne.b    P61_noset
  2101.  
  2102.     move    d0,P61_plcount(a3)
  2103.     st.b    P61_plflag(a3)
  2104. P61_noset
  2105.     tst    P61_plcount(a3)
  2106.     bne.b    P61_looppaa
  2107.     clr.b    P61_plflag(a3)
  2108.     bra    P61_fxdone
  2109.     
  2110. P61_looppaa
  2111.     st.b    P61_plflag+1(a3)
  2112.     subq    #1,P61_plcount(a3)
  2113.     bra    P61_fxdone
  2114.  
  2115. P61_setloop
  2116.     tst.b    P61_plflag(a3)
  2117.     bne    P61_fxdone
  2118.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2119.     lea    P61_temp0+P61_TData(pc),a1
  2120.     lea    P61_looppos(pc),a0
  2121.     moveq    #channels-1,d0
  2122. .talt    move.l    (a1)+,(a0)+
  2123.     move.l    (a1)+,(a0)+
  2124.     move.l    (a1),(a0)+
  2125.     subq.l    #8,a1
  2126.     add.l    d6,a1
  2127.     dbf    d0,.talt
  2128.     bra    P61_fxdone
  2129.     endc
  2130.  
  2131.     ifne    P61_fvu
  2132. P61_finevup
  2133.     moveq    #$f,d0
  2134.     and.b    P61_Info(a5),d0
  2135.     add    d0,P61_Volume(a5)
  2136.     moveq    #64,d0
  2137.     cmp    P61_Volume(a5),d0
  2138.     bge    P61_fxdone
  2139.     move    d0,P61_Volume(a5)
  2140.     bra    P61_fxdone
  2141.     endc
  2142.  
  2143.     ifne    P61_fvd
  2144. P61_finevdwn
  2145.     moveq    #$f,d0
  2146.     and.b    P61_Info(a5),d0
  2147.     sub    d0,P61_Volume(a5)
  2148.     bpl    P61_fxdone
  2149.     clr    P61_Volume(a5)
  2150.     bra    P61_fxdone
  2151.     endc
  2152.  
  2153.     ifne    P61_timing
  2154. P61_sete8
  2155.     moveq    #$f,d0
  2156.     and.b    P61_Info(a5),d0
  2157.     move    d0,P61_E8(a3)
  2158.     bra    P61_fxdone
  2159.     endc
  2160.  
  2161.     ifne    P61_rt
  2162. P61_setretrig
  2163.     moveq    #$f,d0
  2164.     and.b    P61_Info(a5),d0
  2165.     move    d0,P61_RetrigCount(a5)
  2166.     bra    P61_fxdone
  2167.     endc
  2168.  
  2169.     ifne    P61_nd
  2170. P61_ndelay
  2171.     moveq    #$7e,d0
  2172.     and.b    (a5),d0
  2173.     beq    P61_skip
  2174.     ifne    P61_vib
  2175.     clr.b    P61_VibPos(a5)
  2176.     endc
  2177.     ifne    P61_tre
  2178.     clr.b    P61_TrePos(a5)
  2179.     endc
  2180.     ifne    P61_ft
  2181.     add    P61_Fine(a5),d0
  2182.     endc
  2183.     move    d0,P61_Note(a5)
  2184.     move    (a2,d0),P61_Period(a5)
  2185.     ifeq    fade
  2186.     move    P61_Volume(a5),8(a4)
  2187.     else
  2188.     move    P61_Volume(a5),P61_Shadow(a5)
  2189.     endc
  2190.     bra    P61_skip
  2191.     endc
  2192.  
  2193.     ifne    P61_pde
  2194. P61_pattdelay
  2195.     moveq    #$f,d0
  2196.     and.b    P61_Info(a5),d0
  2197.     move    d0,P61_pdelay(a3)
  2198.     st    P61_pdflag(a3)
  2199.     bra    P61_fxdone
  2200.     endc
  2201.  
  2202.     ifne    P61_sd
  2203. P61_cspeed
  2204.     moveq    #0,d0
  2205.     move.b    P61_Info(a5),d0
  2206.  
  2207.     ifne    CIA
  2208.     tst    P61_Tempo(a3)
  2209.     beq.b    P61_VBlank
  2210.     cmp.b    #32,d0
  2211.     bhs.b    P61_STempo
  2212.     endc
  2213.  
  2214. P61_VBlank
  2215.     cmp.b    #1,d0
  2216.     beq.b    P61_jkd
  2217.  
  2218.     move.b    d0,P61_speed+1(a3)
  2219.     subq.b    #1,d0
  2220.     move.b    d0,P61_speed2+1(a3)
  2221.     clr    P61_speedis1(a3)
  2222.     bra    P61_fxdone
  2223.  
  2224. P61_jkd    move.b    d0,P61_speed+1(a3)
  2225.     move.b    d0,P61_speed2+1(a3)
  2226.     st    P61_speedis1(a3)
  2227.     bra    P61_fxdone
  2228.  
  2229.  
  2230.     ifne    CIA
  2231. P61_STempo
  2232.     move.l    P61_timer(pc),d1
  2233.     divu    d0,d1
  2234.     move    d1,P61_thi2(a3)
  2235.     sub    #$1f0*2,d1
  2236.     move    d1,P61_thi(a3)
  2237.  
  2238.     ifeq    system
  2239.     move    P61_thi2(a3),d1
  2240.     move.b    d1,$bfd400
  2241.     lsr    #8,d1
  2242.     move.b    d1,$bfd500
  2243.     endc
  2244.  
  2245.     bra    P61_fxdone
  2246.     endc
  2247.     endc
  2248.  
  2249.  
  2250.  
  2251.     ifne    P61_vbvs
  2252. P61_vibochvslide
  2253.     move.b    P61_Info(a5),d0
  2254.     sub.b    d0,P61_Volume+1(a5)
  2255.     bpl.b    P61_test62
  2256.     clr    P61_Volume(a5)
  2257.     ifeq    fade
  2258.     clr    8(a4)
  2259.     else
  2260.     clr    P61_Shadow(a5)
  2261.     endc
  2262.     bra.b    P61_vib2
  2263. P61_test62
  2264.     moveq    #64,d0
  2265.     cmp    P61_Volume(a5),d0
  2266.     bge.b    .ncs2
  2267.     move    d0,P61_Volume(a5)
  2268. .ncs2    ifeq    fade
  2269.     move    P61_Volume(a5),8(a4)
  2270.     else
  2271.     move    P61_Volume(a5),P61_Shadow(a5)
  2272.     endc
  2273.     endc
  2274.  
  2275.     ifne    P61_vib
  2276. P61_vib2
  2277.     move    #$f00,d0
  2278.     move    P61_VibCmd(a5),d1
  2279.     and    d1,d0
  2280.     lsr    #3,d0
  2281.  
  2282.     lsr    #2,d1
  2283.     and    #$1f,d1
  2284.     add    d1,d0
  2285.  
  2286.     move    P61_Period(a5),d1
  2287.     moveq    #0,d2
  2288.     move.b    P61_vibtab(pc,d0),d2
  2289.  
  2290.     tst.b    P61_VibPos(a5)
  2291.     bmi.b    .vibneg
  2292.     add    d2,d1
  2293.     bra.b    P61_vib4
  2294.  
  2295. .vibneg    sub    d2,d1
  2296.  
  2297. P61_vib4
  2298.     move    d1,6(a4)
  2299.     move.b    P61_VibCmd(a5),d0
  2300.     lsr.b    #2,d0
  2301.     and    #$3c,d0
  2302.     add.b    d0,P61_VibPos(a5)
  2303.     bra    P61_contfxdone
  2304.     endc
  2305.  
  2306.     ifne    P61_tre
  2307. P61_tremo
  2308.     move    #$f00,d0
  2309.     move    P61_TreCmd(a5),d1
  2310.     and    d1,d0
  2311.     lsr    #3,d0
  2312.     
  2313.     lsr    #2,d1
  2314.     and    #$1f,d1
  2315.     add    d1,d0
  2316.  
  2317.     move    P61_Volume(a5),d1
  2318.     moveq    #0,d2
  2319.     move.b    P61_vibtab(pc,d0),d2
  2320.  
  2321.     tst.b    P61_TrePos(a5)
  2322.     bmi.b    .treneg
  2323.     add    d2,d1
  2324.     cmp    #64,d1
  2325.     ble.b    P61_tre4
  2326.     moveq    #64,d1
  2327.     bra.b    P61_tre4
  2328.  
  2329. .treneg    sub    d2,d1
  2330.     bpl.b    P61_tre4
  2331.     moveq    #0,d1
  2332. P61_tre4
  2333.     ifeq    fade
  2334.     move    d1,8(a4)
  2335.     else
  2336.     move    d1,P61_Shadow(a5)
  2337.     endc
  2338.  
  2339.     move.b    P61_TreCmd(a5),d0
  2340.     lsr.b    #2,d0
  2341.     and    #$3c,d0
  2342.     add.b    d0,P61_TrePos(a5)
  2343.     bra    P61_contfxdone
  2344.     endc
  2345.  
  2346.     ifne    P61_vib!P61_tre
  2347. P61_vibtab    incbin    vibtab
  2348.     endc
  2349.  
  2350.     ifne    P61_il
  2351. P61_funk
  2352.     moveq    #$f,d0
  2353.     and.b    P61_Info(a5),d0
  2354.     move.b    d0,P61_Funkspd(a5)
  2355.     bra    P61_fxdone
  2356.  
  2357. P61_funk2
  2358.     moveq    #0,d0
  2359.     move.b    P61_Funkspd(a5),d0
  2360.     beq.b    P61_funkend
  2361.     move.b    P61_FunkTable(pc,d0),d0
  2362.     add.b    d0,P61_Funkoff(a5)
  2363.     bpl.b    P61_funkend
  2364.     clr.b    P61_Funkoff(a5)
  2365.  
  2366.     move.l    P61_Sample(a5),a1
  2367.     move.l    P61_RepeatOffset(a1),d1
  2368.     move    P61_RepeatLength(a1),d0
  2369.     add.l    d0,d0
  2370.     add.l    d1,d0
  2371.     move.l    P61_Wave(a5),a0
  2372.     addq.l    #1,a0
  2373.     cmp.l    d0,a0
  2374.     blo.b    P61_funkok
  2375.     move.l    d1,a0
  2376. P61_funkok
  2377.     move.l    a0,P61_Wave(a5)
  2378.     not.b    (a0)
  2379. P61_funkend
  2380.     rts
  2381.  
  2382. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2383.     endc
  2384.  
  2385. P61_jtab
  2386.     dr    P61_fxdone
  2387.     dr    P61_fxdone
  2388.     dr    P61_fxdone
  2389.  
  2390.     ifne    P61_tp
  2391.     dr    P61_settoneport
  2392.     else
  2393.     dr    P61_fxdone
  2394.     endc
  2395.  
  2396.     ifne    P61_vib
  2397.     dr    P61_vibrato
  2398.     else
  2399.     dr    P61_fxdone
  2400.     endc
  2401.  
  2402.     ifne    P61_tpvs
  2403.     dr    P61_toponochange
  2404.     else
  2405.     dr    P61_fxdone
  2406.     endc
  2407.  
  2408.     dr    P61_fxdone
  2409.  
  2410.     ifne    P61_tre
  2411.     dr    P61_settremo
  2412.     else
  2413.     dr    P61_fxdone
  2414.     endc
  2415.  
  2416.     dr    P61_fxdone
  2417.  
  2418.     ifne    P61_sof
  2419.     dr    P61_sampleoffse
  2420.     else
  2421.     dr    P61_fxdone
  2422.     endc
  2423.     dr    P61_fxdone
  2424.  
  2425.     ifne    P61_pj
  2426.     dr    P61_posjmp
  2427.     else
  2428.     dr    P61_fxdone
  2429.     endc
  2430.  
  2431.     ifne    P61_vl
  2432.     dr    P61_volum
  2433.     else
  2434.     dr    P61_fxdone
  2435.     endc
  2436.  
  2437.     ifne    P61_pb
  2438.     dr    P61_pattbreak
  2439.     else
  2440.     dr    P61_fxdone
  2441.     endc
  2442.  
  2443.     ifne    P61_ec
  2444.     dr    P61_ecommands
  2445.     else
  2446.     dr    P61_fxdone
  2447.     endc
  2448.     
  2449.     ifne    P61_sd
  2450.     dr    P61_cspeed
  2451.     else
  2452.     dr    P61_fxdone
  2453.     endc
  2454.  
  2455.  
  2456. P61_dmason
  2457.     ifeq    system
  2458.     tst.b    $bfdd00
  2459.     move    #$2000,$dff09c
  2460.     move.b    #$19,$bfdf00
  2461.     move.l    a0,-(sp)
  2462.     move.l    P61_vektori(pc),a0
  2463.     move.l    P61_intaddr(pc),(a0)
  2464.     move.l    (sp)+,a0
  2465.     move    P61_dma(pc),$dff096
  2466.     nop
  2467.     rte
  2468.  
  2469.     else
  2470.  
  2471.     move    P61_dma(pc),$96(a6)
  2472.     lea    P61_server(pc),a3
  2473.     addq    #1,(a3)
  2474.     move.l    P61_craddr(pc),a0
  2475.     move.b    #$19,(a0)
  2476.     bra    P61_ohi
  2477.     endc
  2478.  
  2479.  
  2480. P61_setrepeat
  2481.     ifeq    system
  2482.     tst.b    $bfdd00
  2483.     movem.l    a0/a1,-(sp)
  2484.     lea    $dff0a0,a1
  2485.     move    #$2000,-4(a1)
  2486.     else
  2487.     lea    $a0(a6),a1
  2488.     endc
  2489.  
  2490.     move.l    P61_Sample+P61_temp0(pc),a0
  2491.     addq.l    #6,a0
  2492.     move.l    (a0)+,(a1)+
  2493.     move    (a0),(a1)
  2494.  
  2495.     ifgt    channels-1
  2496.     move.l    P61_Sample+P61_temp1(pc),a0
  2497.     addq.l    #6,a0
  2498.     move.l    (a0)+,12(a1)
  2499.     move    (a0),16(a1)
  2500.     endc
  2501.     
  2502.     ifgt    channels-2
  2503.     move.l    P61_Sample+P61_temp2(pc),a0
  2504.     addq.l    #6,a0
  2505.     move.l    (a0)+,28(a1)
  2506.     move    (a0),32(a1)
  2507.     endc
  2508.  
  2509.     ifgt    channels-3
  2510.     move.l    P61_Sample+P61_temp3(pc),a0
  2511.     addq.l    #6,a0
  2512.     move.l    (a0)+,44(a1)
  2513.     move    (a0),48(a1)
  2514.     endc
  2515.  
  2516.     ifne    system
  2517.     ifne    CIA
  2518.     lea    P61_server(pc),a3
  2519.     clr    (a3)
  2520.     move.l    P61_craddr+4(pc),a0
  2521.     move.b    P61_tlo(pc),(a0)
  2522.     move.b    P61_thi(pc),$100(a0)
  2523.     endc
  2524.     bra    P61_ohi
  2525.     endc
  2526.  
  2527.     ifeq    system
  2528.     ifne    CIA
  2529.     move.l    P61_vektori(pc),a0
  2530.     move.l    P61_tintti(pc),(a0)
  2531.     endc
  2532.     movem.l    (sp)+,a0/a1
  2533.     nop
  2534.     rte
  2535.     endc
  2536.  
  2537. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2538.         dc    1
  2539.  
  2540. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2541.         dc    2
  2542.  
  2543. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2544.         dc    4
  2545.  
  2546. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2547.         dc    8
  2548.  
  2549. P61_cn        dc    0
  2550. P61_dma        dc    $8200
  2551. P61_rowpos    dc    0
  2552. P61_slen    dc    0
  2553. P61_speed    dc    0
  2554. P61_speed2    dc    0
  2555. P61_speedis1    dc    0
  2556. P61_spos    dc.l    0
  2557.  
  2558.     ifeq    system
  2559. P61_vektori    dc.l    0
  2560. P61_oldlev6    dc.l    0
  2561.     endc
  2562.  
  2563. P61_ofilter    dc    0
  2564. P61_Timers    dc.l    0
  2565.  
  2566.     ifne    CIA
  2567. P61_tintti    dc.l    0
  2568. P61_thi        dc.b    0
  2569. P61_tlo        dc.b    0
  2570. P61_thi2    dc.b    0
  2571. P61_tlo2    dc.b    0
  2572. P61_timer    dc.l    0
  2573.     endc
  2574.  
  2575.     ifne    P61_pl
  2576. P61_plcount    dc    0
  2577. P61_plflag    dc    0
  2578. P61_plreset    dc    0
  2579. P61_plrowpos    dc    0
  2580. P61_looppos    dcb.b    12*channels
  2581.     endc
  2582.  
  2583.     ifne    P61_pde
  2584. P61_pdelay    dc    0
  2585. P61_pdflag    dc    0
  2586.     endc
  2587.  
  2588. P61_Samples    dcb.b    16*31
  2589. P61_positionbase dc.l    0
  2590. P61_possibase    dc.l    0
  2591. P61_patternbase    dc.l    0
  2592. P61_intaddr    dc.l    0
  2593.  
  2594.     ifne    system
  2595. P61_server    dc    0
  2596. P61_miscbase    dc.l    0
  2597. P61_audioopen    dc.b    0
  2598. P61_sigbit    dc.b    -1
  2599. P61_ciares    dc.l    0
  2600. P61_craddr    dc.l    0,0,0
  2601. P61_dat        dc    $f00
  2602. P61_timerinterrupt dc    0,0,0,0,127
  2603. P61_timerdata    dc.l    0,0,0
  2604.  
  2605. P61_allocport    dc.l    0,0
  2606.         dc.b    4,0
  2607.         dc.l    0
  2608.         dc.b    0,0
  2609.         dc.l    0
  2610. P61_reqlist    dc.l    0,0,0
  2611.         dc.b    5,0
  2612. P61_allocreq    dc.l    0,0
  2613.         dc    127
  2614.         dc.l    0
  2615. P61_portti    dc.l    0
  2616.         dc    68
  2617.         dc.l    0,0,0
  2618.         dc    0
  2619. P61_reqdata    dc.l    0
  2620.         dc.l    1,0,0,0,0,0,0
  2621.         dc    0
  2622. P61_audiodev    dc.b    'audio.device',0
  2623.  
  2624. P61_cianame    dc.b    'ciab.resource',0
  2625. P61_timeropen    dc.b    0
  2626. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2627.     endc
  2628. P61_etu
  2629.  
  2630.     endb    a3
  2631.  
  2632.  
  2633. ******** END OF BINARY FILE **************
  2634.  
  2635.     section    chip,data_c
  2636. P61_data    incbin    "ram:P61.p61-testi"
  2637. ;P61_smp    incbin    "ram:SMP.fields of green"
  2638.  
  2639.     section    smp,bss_c
  2640. samples    ;ds.b    $10000        ;uncomment if you have packed samples
  2641.                 ;and insert sample buffer length
  2642.